﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace CommunitySystem.PageView.demo.sliderdemo
{
    public partial class NewBindWindow : ChildWindow
    {
        private int errorCount = 0;
        public NewBindWindow()
        {
            InitializeComponent();
            this.BindingValidationError += (sender, e) =>
            {
                if (e.Error == null)
                    errorCount--;
                else
                    errorCount++;
            };
            this.DataContext = new CommunitySystem.Model.Silverlight.MenuItem() { IsValidate = true };
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if (errorCount > 0)
                return;
            this.DialogResult = true;
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }
    }
}

